package response

import (
	"github.com/gin-gonic/gin"
	"net/http"
)

type Response struct {
	StatusCode int		`json:"status_code"`
	Data interface{}	`json:"data"`
	Message  string		`json:"message"`
}

func Result(ctx *gin.Context, code int, data interface{}, message string) {
	ctx.JSON(http.StatusOK, Response{
		code,
		data,
		message,
	})
}

func Success(ctx *gin.Context, data interface{}, message string) {
	Result(ctx, 200, data, message)
}

func Fail(ctx *gin.Context, code int, message string) {
	Result(ctx, code, nil, message)
}